package com.example.config;

import com.example.pojo.ResponseVo;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class CustomResponseEntityExceptionHandler {

    @ExceptionHandler(value = Exception.class)
//    @ResponseBody
    public ResponseVo handleException(Exception e) {
        // 日志记录
        // 自定义错误响应
        e.printStackTrace();
        return ResponseVo.no("系统异常,请联系戴戴同志");
    }

}
